<template>
  <div id="app">
    <h2>测试题</h2>
    <MySubject
      v-for="item in total"
      :key="item"
      :item="item"
      @submit="submit"
    ></MySubject>
    <div>
      <MyFlag
        v-for="item in total"
        :key="item"
        :item="item"
        :flag="flag"
        :digit="digit"
      ></MyFlag>
    </div>
  </div>
</template>

<script>
import MySubject from "./components/MySubject.vue";
import MyFlag from "./components/MyFlag.vue";
export default {
  data() {
    return {
      total: 5,
      flag: false,
      digit: 0,
    };
  },
  components: {
    MySubject,
    MyFlag,
  },
  methods: {
    submit(flag, item) {
      this.flag = flag;
      this.digit = item;
    },
  },
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>
